package cn.edu.csust.tysp.backend.controller;

import cn.edu.csust.tysp.backend.common.ApiPageResult;
import cn.edu.csust.tysp.backend.controller.request.SheetMusicPageQueryRequest;
import cn.edu.csust.tysp.backend.domain.SheetMusic;
import cn.edu.csust.tysp.backend.service.SheetMusicService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

@RestController
@RequestMapping("/tysp/sheetmusic")
@Api(tags = "sheet music controller")
public class SheetMusicController {

    @Autowired
    SheetMusicService sheetMusicService;

    @ApiOperation(value = "sheet music page query", notes = "sheet music page query")
    @GetMapping("/pagination")
    public ApiPageResult<List<SheetMusic>> pageQuery(@Valid SheetMusicPageQueryRequest request, BindingResult result) {

        return sheetMusicService.pageQuery(request);
    }

}
